import './App.css';
import 'amis/lib/helper.css';
import 'amis/sdk/iconfont.css';
import 'amis/lib/themes/cxd.css';
import {createBrowserRouter, RouterProvider} from "react-router-dom";
import Layout from "@/pages/Layout.tsx";
import Login from "@/pages/Login.tsx";
import ErrorPage from "@/error-page";
import Company from "@/pages/erp/Company.tsx";
import Customer from "@/pages/erp/Customer.tsx";
import Inventory from "@/pages/erp/Inventory.tsx";
import Permission from "@/pages/admin/Permission.tsx";
import Menu from "@/pages/admin/Menu.tsx";
import User from "@/pages/admin/User.tsx";
import Shop from "@/pages/shop/Shop.tsx";
import ShopDetail from "@/pages/shop/ShopDetail.tsx";
import Product from "@/pages/erp/Product2.tsx";

const router = createBrowserRouter([
  {
    path: "/",
    element: <Layout/>,
    errorElement: <ErrorPage/>,
    children: [
      {
        path: "erp",
        children: [
          {
            path: "company",
            element: <Company/>,
          },
          {
            path: "customer",
            element: <Customer/>,
          },
          {
            path: "inventory",
            element: <Inventory/>,
          },
          {
            path: "product2",
            element: <Product/>,
          },
        ],
      },
      {
        path: 'admin',
        children: [
          {
            path: 'user',
            element: <User/>,
          },
          {
            path: 'permission',
            element: <Permission/>,
          },
          {
            path: 'menu',
            element: <Menu/>,
          },
        ],
      },
      {
        path: 'shop',
        children: [
          {
            path: '',
            element: <Shop/>,
          },
          {
            path: 'detail',
            element: <ShopDetail/>,
          },
        ],
      },
    ],
  },
  {
    path: "/login",
    element: <Login/>,
    errorElement: <ErrorPage/>,
  },
]);

function App() {
  return (
    <RouterProvider router={router}/>
  );
}

export default App;
